# Maintainer: David Runge <dave@sleepmap.de>
pkgname=aliki
pkgver=0.3.0
pkgrel=3
pkgdesc="Measure Impulse Responses using a sine sweep and deconvolution"
arch=('loong64' 'x86_64')
url="https://kokkinizita.linuxaudio.org/linuxaudio/"
license=('GPL2')
groups=('pro-audio')
depends=('clthreads' 'clxclient' 'fftw' 'jack' 'libsndfile' 'zita-alsa-pcmi')
makedepends=('gendesk')
source=("https://kokkinizita.linuxaudio.org/linuxaudio/downloads/$pkgname-$pkgver.tar.bz2")
sha512sums=('4ffb8287b1e0266d0d967d9cffae8f6438b0602e90b2c1cabdbaddf34b959e025d5cc247856642ebbebcaaa1314606b7f58d73b9e616ffcb54280f86f3788596')

prepare() {
  cd "$pkgname-$pkgver"
# remove optimization
  sed -e '/march=native/d' -i source/Makefile
  # XDG desktop files
  gendesk -n \
          --pkgname ${pkgname} \
          --pkgdesc "${pkgdesc}" \
          --name aliki \
          --categories "AudioVideo;Audio"
}

build() {
  cd "$pkgname-$pkgver/source"
  make PREFIX=/usr LIBDIR=lib
}

package() {
  cd "$pkgname-$pkgver/source"
  # installing by hand because the Makefile install target is broken
  install -vDm 755 ${pkgname}{,-rt} -t "${pkgdir}/usr/bin/"
  # XDG desktop integration
  install -vDm 644 "../${pkgname}.desktop" \
    -t "${pkgdir}/usr/share/applications/"
  # docs
  install -vDm 644 ../{AUTHORS,README,doc/${pkgname}-manual.pdf} \
    -t "${pkgdir}/usr/share/doc/${pkgname}/"
}
